In some rare (and weird) cases network manager may provide us
connections without settings (since connection.get_settings() is
actually nullable, and this may lead to have a NULL connection ID, that
eventually breaks the network menu completely:
(gnome-shell:
1579214): GNOME Shell-CRITICAL **: 20:27:14.874: Error:
Argument str2 may not be null
Stack trace:
_sortByName@resource:///org/gnome/shell/ui/status/network.js:119:21
lowerBound@resource:///org/gnome/shell/misc/util.js:253:13
insertSorted@resource:///org/gnome/shell/misc/util.js:279:25
_upsert@resource:///org/gnome/shell/ui/status/network.js:128:21
upsert@resource:///org/gnome/shell/ui/status/network.js:147:21
_addConnection@resource:///org/gnome/shell/ui/status/network.js:578:38
_syncConnections@resource:///org/gnome/shell/ui/status/network.js:511:18
NMDeviceItem@resource:///org/gnome/shell/ui/status/network.js:469:14
NMWiredDeviceItem@resource:///org/gnome/shell/ui/status/network.js:611:1
_createDeviceMenuItem@resource:///org/gnome/shell/ui/status/network.js:1909:16
_ensureDeviceItem@resource:///org/gnome/shell/ui/status/network.js:1744:27
_syncDeviceItem@resource:///org/gnome/shell/ui/status/network.js:1717:18
_addDevice@resource:///org/gnome/shell/ui/status/network.js:1767:14
_loadInitialItems@resource:///org/gnome/shell/ui/status/network.js:1680:18
setClient@resource:///org/gnome/shell/ui/status/network.js:1420:18
setClient@resource:///org/gnome/shell/ui/status/network.js:1651:15
_getClient/<@resource:///org/gnome/shell/ui/status/network.js:2126:30
_getClient@resource:///org/gnome/shell/ui/status/network.js:2125:33
async*_init@resource:///org/gnome/shell/ui/status/network.js:2119:14
SystemIndicator@resource:///org/gnome/shell/ui/quickSettings.js:847:1
Indicator@resource:///org/gnome/shell/ui/status/network.js:2073:1
_setupIndicators@resource:///org/gnome/shell/ui/panel.js:523:29
async*QuickSettings@resource:///org/gnome/shell/ui/panel.js:514:14
_ensureIndicator@resource:///org/gnome/shell/ui/panel.js:903:25
_updateBox@resource:///org/gnome/shell/ui/panel.js:914:34
_updatePanel@resource:///org/gnome/shell/ui/panel.js:868:14
_init@resource:///org/gnome/shell/ui/panel.js:692:14
Panel@resource:///org/gnome/shell/ui/panel.js:648:1
_initializeUI@resource:///org/gnome/shell/ui/main.js:246:13
start@resource:///org/gnome/shell/ui/main.js:180:11
@resource:///org/gnome/shell/ui/init.js:12:47
@resource:///org/gnome/shell/ui/init.js:21:20
Now, despite that specific connection here has valid settings when
loaded from dbus, it may still happen that NM lib fails at other level in
fetching its settings.
That said, we should not fail if a connection has no settings, and
just skip it.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3785>
(cherry picked from commit
0e35a3cbdd52f883dff89d0bdce8b909f1f7d7cc)